/*
package com.ruoyi.web.controller.common;

import com.ruoyi.config.RabbitmqMessageConsumer;
import com.ruoyi.rabbitmq.RabbitMQProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@RestController
@RequestMapping("/api/message")
public class RabbitmqMessageController {

    @Autowired
    private RabbitMQProducerService rabbitmqProducerService;

    @Autowired
    private RabbitmqMessageConsumer messageConsumer;

    private final ExecutorService executorService = Executors.newFixedThreadPool(10);

    */
/**
     * 发送单条消息
     *//*

    @PostMapping("/send")
    public Map<String, String> sendMessage(
            @RequestParam String content,
            @RequestParam String sender) {

        String result = rabbitmqProducerService.sendMessage(content, sender);

        Map<String, String> response = new HashMap<>();
        response.put("status", "success");
        response.put("message", result);
        return response;
    }

    */
/**
     * 模拟并发发送消息（多人同时发送）
     *//*

    @PostMapping("/send-concurrent")
    public Map<String, Object> sendConcurrentMessages(@RequestParam int count) {
        Map<String, Object> response = new HashMap<>();

        if (count <= 0 || count > 100) {
            response.put("status", "error");
            response.put("message", "消息数量应在1-100之间");
            return response;
        }

        // 使用线程池模拟多个用户并发发送
        for (int i = 0; i < count; i++) {
            final int messageNum = i + 1;
            executorService.submit(() -> {
                String user = "User-" + (messageNum % 5 + 1);
                String content = "并发消息 " + messageNum + " 来自 " + user;
                rabbitmqProducerService.sendMessage(content, user);
            });
        }

        response.put("status", "success");
        response.put("message", "已提交 " + count + " 条并发消息发送任务");
        response.put("concurrentUsers", Math.min(5, count));
        return response;
    }

    */
/**
     * 获取消费者状态
     *//*

    @GetMapping("/consumer-stats")
    public Map<String, String> getConsumerStats() {
        Map<String, String> response = new HashMap<>();
        response.put("status", "success");
        response.put("stats", messageConsumer.getConsumerStats());
        return response;
    }

    */
/**
     * 健康检查
     *//*

    @GetMapping("/health")
    public Map<String, String> health() {
        Map<String, String> response = new HashMap<>();
        response.put("status", "up");
        response.put("service", "RabbitMQ Simple Message Service");
        return response;
    }
}
*/
